import loading from "/js/loading.js";
// close order dialog listener
let closeOrderDialog = (curriculumid,el) => {
    $(".order-chahao")[0].addEventListener("click", () => {
        $("#mask").hide();
        $("#mask")[0].style.zIndex = -1;
        $(".cancel-order-dialog")[0].remove();
    });

    $(".cancel-order")[0].addEventListener("click", async () => {
        loading.showLoading({
            type: 2,
            tip: "loading...",
        });
        let res = await ajax('refund',{
            curriculumid : curriculumid
        },'post')
        if(res?.code === 200){
            loading.hideLoading();
            Dreamer.success('取消成功')
            $("#mask").hide();
            $("#mask")[0].style.zIndex = -1;
            $(".cancel-order-dialog")[0].remove();
            $(el).remove()
        }else{
            loading.hideLoading();
            Dreamer.success('取消失败')
            
        }
        console.log(res)
       
    });
};

export {
    closeOrderDialog
}